package com.neusoft.news.controller.clue;

import com.neusoft.news.controller.BaseServlet;
import com.neusoft.news.dao.ClueDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 线索状态更改
 *
 * @author wh
 * @ClassName: ClueStateChangeServlet
 * @Description: 线索状态更改
 * @date 2021年5月23日
 * @since JDK 1.8
 */
@WebServlet("/clueStateChange")
public class ClueStateChangeServlet extends BaseServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doGet(req, resp);
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
        resp.setContentType("text/html;charset=utf-8");
        String clueState = req.getParameter("clue_state");
        String clueId = req.getParameter("clue_id");

        ClueDao clueDao = new ClueDao();
        int i = clueDao.updateClueState(clueId, clueState);


        resp.sendRedirect("/clueList");
    }
}
